﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kovan.DAL.UserCenter;
using Kovan.Model.Entity.UserCenter;

namespace Kovan.BLL.UserCenter
{
    public class BActRoleAuthority
    {
        DActRoleAuthority dal = new DActRoleAuthority();

        #region 当前类的实例
        private static readonly BActRoleAuthority Instances = new BActRoleAuthority();

        private BActRoleAuthority() { }

        public static BActRoleAuthority GetInstances()
        {
            return Instances;
        }
        #endregion

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public act_role_authority GetModel(int id)
        {
            return dal.GetModel(id);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public int Add(act_role_authority model)
        {
            return Add(model);
        }

        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="roidid">角色ID</param>
        /// <param name="ids">权限ID集合</param>
        /// <returns></returns>
        public int BatchAdd(int roidid, IEnumerable<string> ids)
        {
            return dal.BatchAdd(roidid, ids);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public int Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 删除记录（根据角色ID）
        /// </summary>
        /// <param name="roleid"></param>
        /// <returns></returns>
        public int DeleteByRoleID(long roleid)
        {
            return dal.DeleteByRoleID(roleid);
        }

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public int Update(act_role_authority model)
        {
            return dal.Update(model);
        }
    }
}
